package cn.lg.soar.system.biz.modules.general.entity;

import cn.lg.soar.core.annotations.constraints.group.Create;
import cn.lg.soar.core.annotations.constraints.group.Update;
import cn.lg.soar.database.base.entity.BaseEntity;
import cn.lg.soar.database.handler.type.IntListTypeHandler;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 模板分组
 * @author luguoxiang
 * @since 2025-03-03
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Data
@ApiModel(value = "TemplateGroup", description = "模板分组")
@TableName(value = "lg_sys_template_group", autoResultMap = true)
public class TemplateGroup extends BaseEntity {

    /**  */
    @NotNull(message = "主键不能为空", groups = { Update.class })
    @ExcelIgnore
    @ApiModelProperty(value = "主键")
    @TableId
    private Long id;

    /** 编码 */
    @NotBlank(message = "编码不能为空", groups = { Create.class })
    @ExcelProperty(value = "编码")
    @ApiModelProperty(value = "编码")
    private String code;

    /** 类型(数据字典：TemplateTypeEnum) */
    @ExcelProperty(value = "类型(0文件，1纯文本，2富文本)")
    @ApiModelProperty(value = "类型(数据字典：TemplateTypeEnum)")
    @TableField(typeHandler = IntListTypeHandler.class)
    private List<Integer> type;

    /** 名称 */
    @NotBlank(message = "名称不能为空", groups = { Create.class })
    @ExcelProperty(value = "名称")
    @ApiModelProperty(value = "名称")
    private String name;

    /** 备注 */
    @ExcelProperty(value = "备注")
    @ApiModelProperty(value = "备注")
    private String remark;

    /** 排序 */
    @ExcelProperty(value = "排序")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    /** 状态（数据字典：DataStatusEnum）*/
    @NotNull(message = "状态不能为空", groups = { Create.class })
    @ExcelProperty(value = "状态（0启用，1禁用）")
    @ApiModelProperty(value = "状态（数据字典：DataStatusEnum）")
    private Integer status;

    @JsonIgnore
    @Override
    public Long primaryKey() {
        return this.id;
    }

}
